package com.woniuxy.controller;

import com.woniuxy.entity.dto.ChartAndAddrDTO;
import com.woniuxy.service.OrderService;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * @BelongsProject: pigTrotterStore
 * @BelongsPackage: com.woniuxy.controller
 * @Author: Quan
 * @Date: 2025/3/17 19:54
 */
@RestController
@RequestMapping("/order")
public class OrderController {

	@Autowired
	private OrderService orderService;

	@PostMapping("/addOrder")
	public ResponseData<?> addOrder(@RequestBody ChartAndAddrDTO chartAndAddrDTO) {
		try {
			return orderService.addOrder(chartAndAddrDTO);
		} catch (ParseException | InterruptedException e) {
			throw new RuntimeException(e);
		}
	}
}
